﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using automobili_data;
using automobili_data.interfaces;

namespace automobili_gui
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
            postavi();
        }

        private void postavi() {
                      
           
            if ((HttpContext.Current.Session["korisnik"] != null)&&(HttpContext.Current.Session["privilegije"]!=null))
           
            {
               
                Privilegije p = (Privilegije)HttpContext.Current.Session["privilegije"];
           

             //  int i = p.Pretraga_s;

                if (p.Pretraga_s==1)
                {
                    HyperLink link = new HyperLink();
                    link.NavigateUrl = "~/UserManagement/Pretraga.aspx";
                    link.Text = "Pretraga oglasa";
               //     link.Text = ee.ToString();   
                    Panel1.Controls.Add(link);
                    link.ForeColor = System.Drawing.Color.White;
                }
                

                
                if (p.Oglasavanje_k==1)
                {
                    HyperLink link1 = new HyperLink();
                    link1.Text = "   Postavi oglas";
                    link1.NavigateUrl = "~/Ulogovan_korisnik/Oglasavanje.aspx";
                    link1.ForeColor = System.Drawing.Color.White;
                    Panel1.Controls.Add(link1);
                }

                if (p.SopsOglasi == 1)
                {
                    HyperLink link2 = new HyperLink();
                    link2.Text = "   Pregled sopstvenih oglasa";
                    link2.NavigateUrl = "~/Ulogovan_korisnik/PregledSopOglasa.aspx";
                    link2.ForeColor = System.Drawing.Color.White;
                    Panel1.Controls.Add(link2);
                }

                if (p.SopsRezerv_k == 1)
                {
                    HyperLink link3 = new HyperLink();
                    link3.Text = "   Pregled sopstvenih rezervacija";
                    link3.NavigateUrl = "~/Ulogovan_korisnik/PregledSopsRezervacija.aspx";
                    link3.ForeColor = System.Drawing.Color.White;
                    Panel1.Controls.Add(link3);
                }

                if (p.Privilegije_a == 1)
                {
                    HyperLink link4 = new HyperLink();
                    link4.Text = "   Promena privilegija";
                    link4.NavigateUrl = "~/Admin/PregledPrivilegija.aspx";
                    link4.ForeColor = System.Drawing.Color.White;
                    Panel1.Controls.Add(link4);
                }

                if (p.DefNabParAuto_a == 1)
                {
                    HyperLink link5 = new HyperLink();
                    link5.Text = "   Definisanje parametara automobila";
                    link5.NavigateUrl = "~/Admin/DefParametaraAutomobila.aspx";
                    link5.ForeColor = System.Drawing.Color.White;
                    Panel1.Controls.Add(link5);
                }

                if (p.ProfilPromena_k == 1)
                {
                    HyperLink link6 = new HyperLink();
                    link6.Text = "   Profil";
                    link6.NavigateUrl = "~/Ulogovan_korisnik/Profil.aspx";
                    link6.ForeColor = System.Drawing.Color.White;
                    Panel1.Controls.Add(link6);
                }

                if (p.DefParSist_a == 1)
                {
                    HyperLink link7 = new HyperLink();
                    link7.Text = "   Definisanje parametara sistema";
                    link7.NavigateUrl = "~/Admin/DefParametaraSistema.aspx";
                    link7.ForeColor = System.Drawing.Color.White;
                    Panel1.Controls.Add(link7);
                }



               
            }
            

            
        }

        protected void HeadLoginStatus_LoggingOut(object sender, LoginCancelEventArgs e)
        {
            SessionUtils.removeUserInformation();
        }

        
    }
}
